package com.wangfei.lecture.父类与子类方法调用顺序;

//public class Child extends People {
//    public Child() {
//        System.out.println("Chield()");
//    }
//    public Child(String name) {
//        super(name);
//        System.out.println("Child(String name)");
//    }
//    public static void main(String[] args) {
//        new Child("name");
//    }
//}
//
//class People {
//    String name;
//
//    public People() {
//        System.out.println("People()");
//    }
//
//    public People(String name) {
//        System.out.println("People(String name)");
//    }
//}

public class Child extends People {
    private String name = "Jerry";
    public Child() {
        playBasketball();
        playFootball();
    }

    private void playBasketball() {
        System.out.println("People play basketball: " + name);
    }

    public void playFootball() {
        System.out.println("People play football: " + name);
    }

    public static void main(String[] args) {
        new Child();
    }
}
class People {
    private String name = "Tome";

    public People() {
        playBasketball();
        playFootball();
    }

    private void playBasketball() {
        System.out.println("People play basketball: " + name);
    }

    protected void playFootball() {
        System.out.println("People play football: " + name);
    }
}